package simplefactory;

/**
 * @Author Fish Paradise
 * @Description
 * @Date 2019/1/16  9:40
 **/
public class FruitFactory {

    private static String APPLE="Apple";

    private static String ORANGE="Orange";

    private static String GRAPE="Grape";

    Fruit fruit;
    public FruitFactory(String type){
        if(APPLE.equals(type)){
            this.fruit = new Apple();
        }else if(ORANGE.equals(type)){
            this.fruit = new Orange();
        }else if (GRAPE.equals(type)){
            this.fruit = new Grape();
        }
    }

    public Fruit getFruit(){
        return fruit;
    }
}
